﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FrameWork.Lib
{
    public static class SerializationExt
    {
        public static T Clone<T>(this T pObject)
        {
            if (pObject == null) return pObject;
            return (T)Serialization.Serializer.FromXml(Serialization.Serializer.ToXml(pObject), typeof(T));
        }

        public static T FromXML<T>(this string pXML)
        {
            return (T)Serialization.Serializer.FromXml(pXML, typeof(T));
        }
 
        public static string ToXml<T>(this T pObject)
        {
            if (pObject == null) return null;
            return Serialization.Serializer.ToXml(pObject);
        }

    }
}
